package com.home.demo.controller;

import com.home.demo.common.R;
import com.home.demo.entity.dto.userAndRole.UserAndRoleDTO;
import com.home.demo.service.UserAndRoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


/**
 * 
 *
 * 角色用户关联Controller
 */
@RestController
@RequestMapping("/userAndRole")
public class UserAndRoleController {
    @Autowired
    private UserAndRoleService userAndRoleService;

    /**
     * 新增-修改用户角色都走该接口
     */
    @PostMapping("/save")
    public R save(@RequestBody UserAndRoleDTO userAndRoleDTO){
		userAndRoleService.saveInfo(userAndRoleDTO);

        return R.ok();
    }

    /**
     * 删除
     */
    @DeleteMapping("/delete")
    public R delete(@RequestBody UserAndRoleDTO userAndRoleDTO){
		userAndRoleService.removeByIdList(userAndRoleDTO);

        return R.ok();
    }

}
